{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "dc2fe68f",
   "metadata": {},
   "source": [
    "## 图状态一览\n",
    "\n",
    "在模块1中，我们奠定了基础。通过构建一个Agent，它可以：<br/>\n",
    "- act 让模型调用特定的工具\n",
    "- observe 将工具输出传回模型\n",
    "- reason  让模型推理工具输出以决定下一步做什么（例如，调用另一个工具和直接响应）\n",
    "- persist state 使用内存中的检查点来支持带有中断的长时间对话\n",
    "\n",
    "\n",
    "## 目标\n",
    "\n",
    "在本模块中，我们将更深入地了解状态和内存。<br/>\n",
    "首先，让我们回顾一下定义状态模式的几种不同方法。<br/>\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7ee0eb80",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os, getpass\n",
    "from dotenv import load_dotenv,find_dotenv\n",
    "\n",
    "load_dotenv(find_dotenv())  # 加载 .env 文件中的环境变量\n",
    "\n",
    "api_key = os.environ.get('OPENAI_API_KEY')\n",
    "base_url = os.environ.get('OPENAI_BASE_URL')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "667613ad",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "from typing_extensions import TypedDict\n",
    "\n",
    "class TypedDictState(TypedDict):\n",
    "    foo: str\n",
    "    bar: str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "364d1c20",
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import Literal\n",
    "\n",
    "class TypedDictState(TypedDict):\n",
    "    name: str\n",
    "    mood: Literal[\"高兴\",\"悲伤\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "757a5f87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOkAAAFNCAIAAABqr9/4AAAAAXNSR0IArs4c6QAAIABJREFUeJzt3XdcU1fDB/CTTQZJ2HuDgOJEcda9lfKgYhVnHbV119G6OmztcFXrxFWt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fBfb7z7GdRJ075J4/vc9fL44wK91fUNl6rlNYpHn9InfNHOvqFY9OWzeqTMbhg+eYzDoz17cKRDguK+tXqnzIvBniq+Pyt0Nby8o/rEWBInwePD4oQu4Ts5pF7bJ5BJngVvryDeGDXrJ9loBXzw1ed2ps99s3/uOi9hn+MDZ124dM0+U8dBQoQqN8cHpwYmA4vue7/wgv9UbgXhMeQlOLlHpZfJRc3xhB8ERxV/UNt1F0kqKf6xvlbJW1a4nxXdZpvKcAQDQY6Tr7uWFzRxcuffgwqKSR1avMhowOsP6/8+4UZ/ERNts7b3frn3f+HONxpw4Ao3W+u/ee2/v8PONtHqVWqY1aLThHZrb6EEBFJ8zAABupdWWFpk8Ql2sXiuTSTCD9QWRdHot29pmWgCAgO/KZtvsLaBaLVdrrG8s0+u1VjcVAwCEzh5MpvVNKM8zKvqNcQ1oRfH9kKjfXQDAkfXP3UI98dhYRkCyKgWXrR2UTP2D3Sk+3zVLWuCff7sMdgp7UMu0sgqpIxTXUbrLYtPfWuxf8qCiBbclMZ1aL8mXTFweCDuInThEdwEAbt6ckdM8s68W67XU3LVKLlGVZFQkfxgAO4j9OMR810KtMBz++rlrkJhiyzrVPm+gG7SJs6m8Nfd/OVZ3zS4frSl4rPQMcxF5C2BneV2SoobKnPoeb7p36udYx/E7aHcBALI6/dWfassLVM7uPIEHX+DqRGeQZvqE6Q3yGpVSojJiWHA0r/cod9iJ4HDQ7pqpFYaCLEVOulIuxZT1ejaXIfTgahQEPU6GxWHI67Q6Nebuz3V2YUZ24gdH8/A7qIn4HLq7jem0RpUMUysMRgPsKE1gMAFPyOQLmQwmlY+GaDnUXYSsHPcvDkJ2qLsIWaHuImSFuouQFeouQlaouwhZ/R8BFwG5FG/IeAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import random\n",
    "from IPython.display import Image, display\n",
    "from langgraph.graph import StateGraph, START, END\n",
    "\n",
    "def node_1(state):\n",
    "    print(\"---Node 1---\")\n",
    "    return {\"name\": state['name'] + \" 感到 ... \"}\n",
    "\n",
    "def node_2(state):\n",
    "    print(\"---Node 2---\")\n",
    "    return {\"mood\": \"开心\"}\n",
    "\n",
    "def node_3(state):\n",
    "    print(\"---Node 3---\")\n",
    "    return {\"mood\": \"悲伤\"}\n",
    "\n",
    "def decide_mood(state) -> Literal[\"node_2\", \"node_3\"]:\n",
    "        \n",
    "    # 在这里，我们在节点 2、3 之间进行 50/50 的分割\n",
    "    if random.random() < 0.5:\n",
    "\n",
    "        # 50% 的概率，我们返回节点 2\n",
    "        return \"node_2\"\n",
    "    \n",
    "    # 50% 的概率，我们返回节点 3\n",
    "    return \"node_3\"\n",
    "\n",
    "# 建立图\n",
    "builder = StateGraph(TypedDictState)\n",
    "builder.add_node(\"node_1\", node_1)\n",
    "builder.add_node(\"node_2\", node_2)\n",
    "builder.add_node(\"node_3\", node_3)\n",
    "\n",
    "# 逻辑\n",
    "builder.add_edge(START, \"node_1\")\n",
    "builder.add_conditional_edges(\"node_1\", decide_mood)\n",
    "builder.add_edge(\"node_2\", END)\n",
    "builder.add_edge(\"node_3\", END)\n",
    "\n",
    "\n",
    "graph = builder.compile()\n",
    "\n",
    "\n",
    "display(Image(graph.get_graph().draw_mermaid_png()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "303e80c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "---Node 1---\n",
      "---Node 3---\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'name': 'Roonie 感到 ... ', 'mood': '悲伤'}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "graph.invoke({\"name\":\"Roonie\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "34c95ab5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from dataclasses import dataclass\n",
    "\n",
    "@dataclass\n",
    "class DataclassState:\n",
    "    name: str\n",
    "    mood: Literal[\"开心\",\"悲伤\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5e5a5fc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOkAAAFNCAIAAABqr9/4AAAAAXNSR0IArs4c6QAAIABJREFUeJzt3XdcU1fDB/CTTQZJ2HuDgOJEcda9lfKgYhVnHbV119G6OmztcFXrxFWtdfaxVapoXa2zTgoqDjbIhjCy103y/hHflPYJSDU3596b8/34B2Txi/lxOLm591yayWQCCEJCdNgBEOQVoe4iZIW6i5AV6i5CVqi7CFmh7iJkxYQdACYDZqp6rlHJDSo5ZsRMOi0JNhdyuHQGi8Z3ZvKcGV5BTrDjwERzwO27Wo0h+768MEtZlqf2DnLiChg8Z6bIg6VTG2FHezk2l15fqVPKMQaTVvxEFRLDD43hR3Ryhp0LAofr7u2ztUVPlD7B3JAYfmAUD3ac16LXGQuzlEVPlM+fqXrEu7fuKoSdyK4cqLu5mfKLh6q6DHbtMtgVdhYbUysMf5yWSMq0gyd7u3iyYcexE0fp7q0ztRqVofcoDwaTBjsLXqQS/end5d2Gu4V3EMDOYg8O0d0/zkjYTvTOA6k23Fp17kBFTA9RQCtyT4dagvrbyH79vpLFpjlIcQEAw6b6PLohfXi9AXYQ3FG8u/cv1oncWV0Gu8EOYlfDp/nkZSrK8tWwg+CLyt0tfqpUygzdRzhWcc1GzfNPv1ivUWKwg+CIyt299rOkfW8R7BTQRHQS3EithZ0CR5Tt7uPbUr8wrtjDUTYY/a/oOGFlsaa+Sgc7CF4o2938B4qeCY44W2isd6LHwxtS2CnwQs3uluer9ToTh8uAHQSywCjeoxtSqm4GpWZ3C7KUoTF8O//QDz/88PTp069wx4EDB5aXl+OQCAAAQmL4hVlKnB4cLmp2t65SG9rW3p8tPX369BXuVVlZ2dCA47bY8A788gJqbiyj5udq297Pm/NNGI2Gy8e/p06dOn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6GxWHI67Q6Nebuz3V2YUZ24gdH8/A7qIn4HLq7jem0RpUMUysMRgPsKE1gMAFPyOQLmQwmlY+GaDnUXYSsHPcvDkJ2qLsIWaHuImSFuouQFeouQlaouwhZ/R8BFwG5FG/IeAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def node_1(state):\n",
    "    print(\"---Node 1---\")\n",
    "    return {\"name\": state.name + \" is ... \"}\n",
    "\n",
    "# 建立图\n",
    "builder = StateGraph(DataclassState)\n",
    "builder.add_node(\"node_1\", node_1)\n",
    "builder.add_node(\"node_2\", node_2)\n",
    "builder.add_node(\"node_3\", node_3)\n",
    "\n",
    "# 逻辑\n",
    "builder.add_edge(START, \"node_1\")\n",
    "builder.add_conditional_edges(\"node_1\", decide_mood)\n",
    "builder.add_edge(\"node_2\", END)\n",
    "builder.add_edge(\"node_3\", END)\n",
    "\n",
    "\n",
    "graph = builder.compile()\n",
    "\n",
    "\n",
    "display(Image(graph.get_graph().draw_mermaid_png()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8eb1cef5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "---Node 1---\n",
      "---Node 3---\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'name': 'Roonie is ... ', 'mood': '悲伤'}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "graph.invoke(DataclassState(name=\"Roonie\",mood=\"悲伤\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "1cd052f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "dataclass_instance = DataclassState(name=\"Ronnie\", mood=\"失望\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "6e79f4d7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Validation Error: 1 validation error for PydanticState\n",
      "mood\n",
      "  Value error, mood 值必须是'高兴' 或 '悲伤' [type=value_error, input_value='失望', input_type=str]\n",
      "    For further information visit https://errors.pydantic.dev/2.10/v/value_error\n"
     ]
    }
   ],
   "source": [
    "from pydantic import BaseModel, field_validator, ValidationError\n",
    "\n",
    "class PydanticState(BaseModel):\n",
    "    name: str\n",
    "    mood: str # \"高兴\" or \"悲伤\" \n",
    "\n",
    "    @field_validator('mood')\n",
    "    @classmethod\n",
    "    def validate_mood(cls, value):\n",
    "        # 确保mood是“快乐”或“悲伤”\n",
    "        if value not in [\"高兴\", \"悲伤\"]:\n",
    "            raise ValueError(\"mood 值必须是'高兴' 或 '悲伤'\")\n",
    "        return value\n",
    "\n",
    "try:\n",
    "    state = PydanticState(name=\"Ronnie\", mood=\"失望\")\n",
    "except ValidationError as e:\n",
    "    print(\"Validation Error:\", e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "9da4b2b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOkAAAFNCAIAAABqr9/4AAAAAXNSR0IArs4c6QAAIABJREFUeJzt3XdcU1fDB/CTTQZJ2HuDgOJEcda9lfKgYhVnHbV119G6OmztcFXrxFWtdfaxVapoXa2zTgoqDjbIhjCy103y/hHflPYJSDU3596b8/34B2Txi/lxOLm591yayWQCCEJCdNgBEOQVoe4iZIW6i5AV6i5CVqi7CFmh7iJkxYQdACYDZqp6rlHJDSo5ZsRMOi0JNhdyuHQGi8Z3ZvKcGV5BTrDjwERzwO27Wo0h+768MEtZlqf2DnLiChg8Z6bIg6VTG2FHezk2l15fqVPKMQaTVvxEFRLDD43hR3Ryhp0LAofr7u2ztUVPlD7B3JAYfmAUD3ac16LXGQuzlEVPlM+fqXrEu7fuKoSdyK4cqLu5mfKLh6q6DHbtMtgVdhYbUysMf5yWSMq0gyd7u3iyYcexE0fp7q0ztRqVofcoDwaTB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updWWFpk8Ql2sXiuTSTCD9QWRdHot29pmWgCAgO/KZtvsLaBaLVdrrG8s0+u1VjcVAwCEzh5MpvVNKM8zKvqNcQ1oRfH9kKjfXQDAkfXP3UI98dhYRkCyKgWXrR2UTP2D3Sk+3zVLWuCff7sMdgp7UMu0sgqpIxTXUbrLYtPfWuxf8qCiBbclMZ1aL8mXTFweCDuInThEdwEAbt6ckdM8s68W67XU3LVKLlGVZFQkfxgAO4j9OMR810KtMBz++rlrkJhiyzrVPm+gG7SJs6m8Nfd/OVZ3zS4frSl4rPQMcxF5C2BneV2SoobKnPoeb7p36udYx/E7aHcBALI6/dWfassLVM7uPIEHX+DqRGeQZvqE6Q3yGpVSojJiWHA0r/cod9iJ4HDQ7pqpFYaCLEVOulIuxZT1ejaXIfTgahQEPU6GxWHI67Q6Nebuz3V2YUZ24gdH8/A7qIn4HLq7jem0RpUMUysMRgPsKE1gMAFPyOQLmQwmlY+GaDnUXYSsHPcvDkJ2qLsIWaHuImSFuouQFeouQlaouwhZ/R8BFwG5FG/IeAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 建立图\n",
    "builder = StateGraph(PydanticState)\n",
    "builder.add_node(\"node_1\", node_1)\n",
    "builder.add_node(\"node_2\", node_2)\n",
    "builder.add_node(\"node_3\", node_3)\n",
    "\n",
    "# 逻辑\n",
    "builder.add_edge(START, \"node_1\")\n",
    "builder.add_conditional_edges(\"node_1\", decide_mood)\n",
    "builder.add_edge(\"node_2\", END)\n",
    "builder.add_edge(\"node_3\", END)\n",
    "\n",
    "\n",
    "graph = builder.compile()\n",
    "\n",
    "\n",
    "display(Image(graph.get_graph().draw_mermaid_png()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "708cf360",
   "metadata": {},
   "outputs": [
    {
     "ename": "ValidationError",
     "evalue": "1 validation error for PydanticState\nmood\n  Value error, mood 值必须是'高兴' 或 '悲伤' [type=value_error, input_value='失望', input_type=str]\n    For further information visit https://errors.pydantic.dev/2.10/v/value_error",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValidationError\u001b[0m                           Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[12], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m graph\u001b[38;5;241m.\u001b[39minvoke(\u001b[43mPydanticState\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mRonnie\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43mmood\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m失望\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n",
      "File \u001b[1;32mD:\\CacheData\\anaconda\\envs\\python310\\lib\\site-packages\\pydantic\\main.py:214\u001b[0m, in \u001b[0;36mBaseModel.__init__\u001b[1;34m(self, **data)\u001b[0m\n\u001b[0;32m    212\u001b[0m \u001b[38;5;66;03m# `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks\u001b[39;00m\n\u001b[0;32m    213\u001b[0m __tracebackhide__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m--> 214\u001b[0m validated_self \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__pydantic_validator__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalidate_python\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mself_instance\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m    215\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m validated_self:\n\u001b[0;32m    216\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m    217\u001b[0m         \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mA custom validator is returning a value other than `self`.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m    218\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mReturning anything other than `self` from a top level model validator isn\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt supported when validating via `__init__`.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    219\u001b[0m         \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSee the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details.\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[0;32m    220\u001b[0m         stacklevel\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m2\u001b[39m,\n\u001b[0;32m    221\u001b[0m     )\n",
      "\u001b[1;31mValidationError\u001b[0m: 1 validation error for PydanticState\nmood\n  Value error, mood 值必须是'高兴' 或 '悲伤' [type=value_error, input_value='失望', input_type=str]\n    For further information visit https://errors.pydantic.dev/2.10/v/value_error"
     ]
    }
   ],
   "source": [
    "graph.invoke(PydanticState(name=\"Ronnie\",mood=\"失望\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "10fc9126",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10",
   "language": "python",
   "name": "python310"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
